#include "mcsytimer.h"

MCsyTimer::MCsyTimer():MCsy()
{
    d_timerId = -1;
}
void MCsyTimer::start()
{
    if ( d_timerId >= 0 )
    {
        killTimer(d_timerId);
        d_timerId = -1;
    }
    d_timerId = startTimer(100);
    //starttime=timeGetTime()/1000.0;
    miaobiao.restart();
}
void MCsyTimer::stop()
{
    if ( d_timerId >= 0 )
    {
        killTimer(d_timerId);
        d_timerId = -1;
    }
}
void MCsyTimer::timerEvent(QTimerEvent *)
{
    QList<double> l;
    //double t=timeGetTime()/1000.0-starttime;
    double t=miaobiao.elapsed()/1000.0;
    l.append(t);
//    l.append(card->getchanelVolt(7));
//    l.append(card->getchanelVolt(8));
//    l.append(card->getchanelVolt(10));
//    l.append(card->getchanelVolt(6));
    //cs
    l.append(card->getchanelVolt(2));
    l.append(card->getchanelVolt(0));
    l.append(card->getchanelVolt(1));
    l.append(card->getchanelVolt(3));
    emit dataArrive(l);
}
void MCsyTimer::setCard(CCard* c)
{
    card=c;
}
